#ifndef __SPLITTOOL_H
#define __SPLITTOOL_H
#include "../../lib/cppjieba/Jieba.hpp"
#include "Mylogger.hh"
#include <set>
#include <map>
#include <fstream>
#include <string>
#include <iostream>
#include <vector>
using std::map;
using std::set;
using std::string;
using std::ifstream;
using std::vector;
using cppjieba::Jieba;

class SplitTool
{
public:
static SplitTool *getInstance();
    void Splitwords(const string & str,vector<string>& words);
    void Splitwords(const string & str,map<string,int>& words);
private:
    SplitTool();
    SplitTool(const SplitTool &) = delete;
    SplitTool& operator=(const SplitTool &) = delete;
    ~SplitTool() = default;
class AutoRelease//自动释放单例类
{
public:
    AutoRelease();
    ~AutoRelease()
    {
        if(_pInstance){
            delete _pInstance;
            _pInstance = nullptr;
        }
    }
};
public:
    Jieba _jieba;
    set<string> _stop_ch; 
private:
    static SplitTool* _pInstance;
    static AutoRelease _ar;
};
 
#endif